
import VueRouter from 'vue-router' // 路由管理器

export default new VueRouter({
  routes: [
    { // 登录
      path: '/login',
      component: () => import('@/views/login/index.vue')
    },
    { // 首页
      path: '/',
      component: () => import('@/views/layout/index.vue'),
      children: [
        {
          path: 'home',
          alias: '',
          component: () => import('@/views/home/index.vue')
        },
        {
          path: 'qa',
          component: () => import('@/views/qa/index.vue')
        },
        {
          path: 'video',
          component: () => import('@/views/video/index.vue')
        },
        {
          path: 'my',
          component: () => import('@/views/my/index.vue')
        }
      ]
    },
    { // 搜索
      path: '/search',
      component: () => import('@/views/search')
    },
    { // 文章详情
      path: '/article/:aid',
      name: 'article',
      component: () => import('@/views/article/index.vue'),
      // 将路由动态参数映射到组件的props中，更推荐用这种做法
      props: true
    },
    { // 个人资料
      path: '/profile',
      component: () => import('@/views/profile/index.vue')
    },
    { // 我的收藏
      path: '/collection',
      component: () => import('@/views/my/compoents/collection')
    },
    { // 历史浏览记录
      path: '/history',
      component: () => import('@/views/my/compoents/history')
    }
  ]
})
